package org.teemor.demo.netty.component.fastthreadlocal;

import io.netty.util.concurrent.FastThreadLocal;
import io.netty.util.concurrent.FastThreadLocalThread;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class FastThreadLocalTest {


    @Test
    public void testOnRemoveCalled() throws Exception {

        final FastThreadLocal threadLocal = new FastThreadLocal();
        final FastThreadLocal threadLocal2 = new FastThreadLocal();

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                threadLocal.set(Thread.currentThread().getName());
                threadLocal2.set(Thread.currentThread().getName());
            }
        };
        Thread thread = new FastThreadLocalThread(runnable);
        thread.start();
        thread.join();
    }

}
